package drds.global_transaction.resource_manager.undolog;

import drds.common.ShouldNeverHappenException;
import drds.global_transaction.resource_manager.undolog.undo_executor.DeleteUndoExecutor;
import drds.global_transaction.resource_manager.undolog.undo_executor.InsertUndoExecutor;
import drds.global_transaction.resource_manager.undolog.undo_executor.UndoExecutor;
import drds.global_transaction.resource_manager.undolog.undo_executor.UpdateUndoExecutor;

public class UndoExecutorFactory
{

	public static UndoExecutor getUndoExecutor(UndoLog undoLog)
	{
		switch (undoLog.getSqlType())
		{
		case insert:
			return new InsertUndoExecutor(undoLog);
		case update:
			return new UpdateUndoExecutor(undoLog);
		case delete:
			return new DeleteUndoExecutor(undoLog);
		default:
			throw new ShouldNeverHappenException();
		}
	}
}
